package Service.Impl;

import Dao.Impl.ProductDapImpl;
import Dao.ProductDao;
import Domain.Product;
import Service.ProductService;

import java.util.ArrayList;
import java.util.List;

public class ProductServiceImpl implements ProductService {
    private ProductDao dao = new ProductDapImpl();
    @Override
    public List<Product> FindProductById(int id) {
        return dao.FindProductById(id);
    }

    @Override
    public List<Product> FindProductByTypeid(int tid) {
        return dao.FindProductByTypeid(tid);
    }

    @Override
    public List<Product> FindProductAll() {
        return dao.FindProductAll();
    }

    @Override
    public List<Product> likeProduct(String Name) {
        return dao.likeProduct(Name);
    }

    @Override
    public List<Product> getProducts(List<String> ids) {
        List<Product> ps = new ArrayList<>();
        Product p=new Product();
            for (String id : ids) {
                p=dao.FindProductById(Integer.parseInt(id)).get(0);
                ps.add(p);
            }

    @Override
    public List<Product> getProducts(List<String> ids) {
        List<Product> ps = new ArrayList<>();
        Product p=new Product();
        for (String id : ids) {
            p=dao.FindProductById(Integer.parseInt(id)).get(0);
            ps.add(p);
        }


        return ps;
    }


        return ps;
    }
}
